package com.derbysoft.lowcostadapter.dswitch3.translate.impl;

import org.apache.commons.lang3.StringUtils;

/**
 * User: jason
 * Date: 2013-04-02
 */
public enum CreditCardType {
    MC(2),
    AE(10);

    private int code;

    private CreditCardType(Integer code) {
        this.code = code;
    }

    public static boolean containsType(String type) {
        for (CreditCardType creditCardType : values()) {
            if (StringUtils.equalsIgnoreCase(creditCardType.name(), type)) {
                return true;
            }
        }
        return false;
    }

    public static Integer getCode(String type) {
        for (CreditCardType creditCardType : values()) {
            if (StringUtils.equalsIgnoreCase(creditCardType.name(), type)) {
                return creditCardType.getCode();
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
